<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var sentence = 'good afternoon, mr mike.';
        // write your code here...
        function titleCase(s) {
            var i, ss = s.toLowerCase().split(/\s+/);
            for (i = 0; i < ss.length; i++) {
                ss[i] = ss[i].slice(0, 1).toUpperCase() + ss[i].slice(1);
            }
            return ss.join(' ');
        }
        console.log(titleCase(sentence));
    </script>
</head>
<body>

</body>
</html>